// hack.h

// Copyright (C) 2010  traxex

// Author: 	traxex <traxex@yahoo.cn>
// Created: 	04 Aug 2010
// Version: 	1.0

#pragma once

namespace traxex{ namespace Private{
template<typename A, typename B>class op_type_helper{
    static A a();
    static B b();
  public:
    typedef typeof( a()+b() )	R;
};
#define optype(A,B)		typename Private::op_type_helper<A,B>::R
}}

#define __maxalign__		__attribute__((aligned))
#define __align_as__(t)		__attribute__((aligned(sizeof(t))))
#define __align_as2__(t)	__attribute__((aligned(2*sizeof(t))))
#define __align_as3__(t)	__attribute__((aligned(3*sizeof(t))))
#define __align_as4__(t)	__attribute__((aligned(4*sizeof(t))))


#ifdef __CUDACC__
#	define pure		__host__ __device__ inline
#	define static_assert(...)
#else	
#	define pure		inline
#	define __align__(n)	__attribute__((aligned(n)))
#endif



#define STR( var)		STRI(var)
#define STRI(var)		#var


#define CAT(a, b) 		CAT_I(a, b)
#define CAT_I(a, b) 		a##b


